package org.bultreebank.indexing;

import org.w3c.dom.Document;

public interface IndexManager
{
	public void clearIndexingReportDocument();
	public void initIndexingReportDocument() throws Exception;
	/**
	 * Sets in the indexing process a document that is a report of
	 * the indexing process 
	 * @param reportDoc - an empty report doc
	 */
	public Document getIndexingReportDocument();
	/**
	 * Adds the document with the specified document ID to the specified index
	 * @param docID - document ID of a document available in the Search
	 *  Engine Document Repository if it exists 
	 * @param usersIndexID - user defined indexID
	 * @throws Exception
	 */
	public void indexDocument(String docID, Document metadataDoc, 
			String index, boolean returnReport) throws Exception;
	
	/**
	 * Adds the document specified to the index and saves it in the Search
	 * engine document repository if it exists. The document identifier for 
	 * the XML document to index is determined by the following priority order:
	 * 	1) explicitly defined document ID
	 * 	2) metadata document
	 * 	3) indexing schema field
	 * If no docID is specified an Exception is thrown
	 * @param xmlDocument - an XML document to index
	 * @param metadataDocument - a metadata document containing additional info 
	 * for the XML document to index
	 * @param index - user defined index ID
	 * @param docID - explicitly defined document ID
	 * @return
	 * @throws Exception
	 */
	public void indexDocument(Document xmlDocument, Document metadataDocument, 
				String index, String docID,
				boolean returnReport) throws Exception ;

	/**
	 * Deletes a document from the index specified
	 * @param docID - user defined document ID
	 * @param index
	 * @throws Exception
	 */
	public void deleteDocFromIndex(String docID, String index) throws Exception;
}
